#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "piece.h"



/*void imInit(image * im , int x, int y)
{
    assert(x>0 && y>0);
    assert(im!=NULL);
    im->dimx=x;
    im->dimy=y;
    im->tab= (pixel*)malloc(x*y*(sizeof(pixel)));
}*/








/*
piece *CreerPiece(int type, int couleur)
{
piece *piece;
piece = malloc(sizeof(piece));
piece->type = type;
piece->couleur = couleur;
switch (type)
{

case 1:
InitLine (piece);
break;

case 2:
InitSquare (piece);
break;

case 3:
InitZLeft (piece);
break;

case 4:
InitZRight (piece);
break;

case 5:
InitLLeft (piece);
break;

case 6:
InitLRight (piece);
break;

case 7:
InitT (piece);
break;

case 8:
InitCenterBloc(piece);
break;

default:
printf("Erreur type , type nombre entre 1 et 8 .");
break;
}

return piece;
}







void InitLine (piece*  p)
{
    p->tab[16] = {0,1,0,0,
                      0,2,0,0,
                      0,1,0,0,
                      0,1,0,0};




}




void InitZRight (piece*  p)
{
    p->tab[16]={0,1,0,0,
                0,2,0,0,
                0,1,0,0,
                0,1,0,0};
}

void InitLLeft (piece*  p)
{
    p->tab[16]={0,1,0,0,
                0,2,0,0,
                1,1,0,0,
                0,0,0,0};
}

void InitLRight (piece*  p)
{
    p->tab[16]={0,1,0,0
                0,2,0,0
                0,1,1,0
                0,0,0,0};
}

void InitT (piece*  p)
{
    p->tab[16]={0,0,0,0,
                1,2,1,0,
                0,1,0,0,
                0,0,0,0};
}

void InitCenterBloc(piece* p)
{
    p->tab[16]={0,0,0,0,
                0,2,1,0,
                0,1,1,0,
                0,0,0,0};
}
*/
/*static int PIECES[NB_KINDS][NB_ROTATIONS][SIZE][SIZE] =
{
    { // O
        {
            {0, 0, 0, 0},
            {0, 1, 2, 0},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 0},
            {0, 1, 2, 0},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 0},
            {0, 1, 2, 0},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 0},
            {0, 1, 2, 0},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        }
    },

    { // I
        {
            {0, 0, 0, 0},
            {1, 1, 2, 1},
            {0, 0, 0, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 0},
            {0, 0, 1, 0},
            {0, 0, 1, 0}
        },

        {
            {0, 0, 0, 0},
            {1, 1, 2, 1},
            {0, 0, 0, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 0},
            {0, 0, 1, 0},
            {0, 0, 1, 0}
        }
    },

    { // S
        {
            {0, 0, 0, 0},
            {0, 0, 2, 1},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 1},
            {0, 0, 0, 1},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 0},
            {0, 0, 2, 1},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 1},
            {0, 0, 0, 1},
            {0, 0, 0, 0}
        }
    },

    { // Z
        {
            {0, 0, 0, 0},
            {0, 1, 2, 0},
            {0, 0, 1, 1},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 1},
            {0, 0, 2, 1},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 0},
            {0, 1, 2, 0},
            {0, 0, 1, 1},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 0, 1},
            {0, 0, 2, 1},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        }
    },

    { // L
        {
            {0, 0, 0, 0},
            {0, 1, 2, 1},
            {0, 1, 0, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 0},
            {0, 0, 1, 1},
            {0, 0, 0, 0}
        },
        {
            {0, 0, 0, 1},
            {0, 1, 2, 1},
            {0, 0, 0, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 1, 1, 0},
            {0, 0, 2, 0},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        }
    },

    { // J
        {
            {0, 0, 0, 0},
            {0, 1, 2, 1},
            {0, 0, 0, 1},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 1},
            {0, 0, 2, 0},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 1, 0, 0},
            {0, 1, 2, 1},
            {0, 0, 0, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 0},
            {0, 1, 1, 0},
            {0, 0, 0, 0}
        }
    },

    { // T
        {
            {0, 0, 0, 0},
            {0, 1, 2, 1},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 0, 2, 1},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        },

        {
            {0, 0, 1, 0},
            {0, 1, 2, 1},
            {0, 0, 0, 0},
            {0, 0, 0, 0}
        },
        {
            {0, 0, 1, 0},
            {0, 1, 2, 0},
            {0, 0, 1, 0},
            {0, 0, 0, 0}
        }
    }
};*/
